############################################################
# Makefile for the regression tests that are run on travis
############################################################
ROOT = ../../../..

test-documentation:
	(cd $(ROOT)/Buildings; ../bin/runUnitTests.py --validate-html-only)
	(cd $(ROOT)/Buildings/Resources/Documentation/userGuide; make regressiontest)
	(cd $(ROOT)/Buildings/Resources/src/fluid/heatpumps/calibration/doc; make regressiontest)

test-experiment-setup:
	(cd $(ROOT)/Buildings; ../bin/runUnitTests.py --validate-experiment-setup)

test-autogenerated-files:
	#echo ### Check for package.order to be up to date
	(cd  $(ROOT)/Buildings; \
	  python -c 'import buildingspy.development.refactor as r; \
	  r.write_package_order(".", recursive=True)'; \
	  git diff --exit-code . )

	#echo ### Verify that all OpenModelica scripts are up to date, and no old scripts exist
	(cd  $(ROOT)/Buildings && \
	  rm Resources/Scripts/OpenModelica/compareVars/*.mos && \
	  python -c 'import buildingspy.development.regressiontest as u; \
	  u.Tester().writeOpenModelicaResultDictionary()')
	git status --porcelain $(ROOT)/Buildings/Resources/Scripts/OpenModelica;
	test -z "$$(git status --porcelain $(ROOT)/Buildings/Resources/Scripts/OpenModelica)"

	#echo ### Check for UnitConversion package to be consistent with the script that generates it
	(cd  $(ROOT); \
	  python Buildings/Resources/src/Controls/OBC/UnitConversions/unit_converters.py; \
	  git diff --exit-code Buildings)


test-dymola:
	(cd $(ROOT)/Buildings && \
		python ../bin/runUnitTests.py --batch --single-package $(PACKAGE) --tool dymola)

test-jmodelica:
	(cd $(ROOT)/Buildings && \
	  export PYTHONPATH=$(TRAVIS_BUILD_DIR)/Buildings/Resources/Python-Sources && \
	  python ../bin/runUnitTests.py --batch --single-package $(PACKAGE) --tool jmodelica --skip-verification)
